package com.chinaisafe.user.vo.request;

import com.chinaisafe.base.common.vo.request.PageReqVo;
import com.chinaisafe.base.common.validated.AddGroup;
import com.chinaisafe.base.common.validated.UpdateGroup;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import com.chinaisafe.user.entity.SysUserRole;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;

/**
 * SysUserRoleReqVO
 * Description：用户角色请求值对象
 *
 * @author xuefu.shu
 * @date  2024-07-13 16:53:56
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Schema(name = "SysUserRoleReqVO", description = "用户角色请求值对象")
public class SysUserRoleReqVO extends PageReqVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键id")
    @NotNull(groups = UpdateGroup.class, message = "主键id不能为空" )
    private Long id;

    @Schema(description = "乐观锁版本")
    private Integer version;

    @Schema(description = "角色_id")
    private Long sysRoleId;

    @Schema(description = "用户_id")
    private Long sysUserId;


    /**
     * 将请求值对象装换为实体
     * @return SysUserRole
     * @author xuefu.shu
     * @date 2024-07-13 16:53:56
     */
    public SysUserRole convertToEntity() {
        SysUserRole entity = new SysUserRole();
        entity.setId(this.id);
        entity.setVersion(this.version);
        // 给实体对应的字段赋值 可根据实际业务删减
        entity.setSysRoleId(this.sysRoleId);
        entity.setSysUserId(this.sysUserId);
        return entity;
    }
}
